<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        *{
            margin:0;
            padding:0;
        }
        .w{
            width:calc(100% - 80px);/*必须有空格，主内容区域始终距离左右40px*/
            height:500px;
            background-color: darkblue;
            margin:0 auto;
        }

    </style>
</head>
<body>
<div class="w"></div>
</body>
</html>